﻿Imports QueComer

Public Class BuscarRestaurantes

    Private Sub Label1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs)

    End Sub

    Private Sub ComboBox1_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs)

    End Sub

    Private Sub Label3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs)

    End Sub

    Private Sub dgvCategorias_CellContentClick(ByVal sender As System.Object, ByVal e As System.Windows.Forms.DataGridViewCellEventArgs) Handles dgvCategorias.CellContentClick

    End Sub

    Private Sub Buscador_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load

    End Sub

    Private Sub btnBuscar_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnBuscar.Click
        Try

            Dim nombre As String = Me.xnombre.Text
            Dim tipo_comida As String = Me.xespe.Text
            Dim distrito As String = Me.xdistrito.Text
            'MsgBox(criterio)

            Dim negocio As New Buscar
            Dim categorias As Collection = negocio.buscar(nombre, tipo_comida, distrito)
            Me.dgvCategorias.DataSource = categorias
            Me.dgvCategorias.EditMode = False

            Me.dgvCategorias.Columns(1).HeaderText = "Restaurante"
            Me.dgvCategorias.Columns(2).HeaderText = "Tipo de cocina"
            Me.dgvCategorias.Columns(3).HeaderText = "Distrito"
            Me.dgvCategorias.Columns(4).HeaderText = "Dirección"

            Me.dgvCategorias.Columns("idrestaurant").Visible = False
            Me.dgvCategorias.Columns("ruc").Visible = False

        Catch ex As Exception
            Me.LabelError.Text = "No se encontraron registros"
        End Try

    End Sub

    Private Sub MaskedTextBox1_MaskInputRejected(ByVal sender As System.Object, ByVal e As System.Windows.Forms.MaskInputRejectedEventArgs) Handles xnombre.MaskInputRejected

    End Sub

    Private Sub Label1_Click_1(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Label1.Click

    End Sub

    Private Sub Label3_Click_1(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Label3.Click

    End Sub

    Private Sub GroupBox1_Enter(sender As System.Object, e As System.EventArgs) Handles GroupBox1.Enter

    End Sub

    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
        Try
            Dim seleccionado = Me.dgvCategorias.CurrentRow.Cells(1).Value.ToString

            Dim form As New Ofertas
            form.MdiParent = Me.MdiParent
            form.Text = seleccionado
            form.BuscarRestaurantes = Me
            form.Show()
        Catch ex As Exception
            Me.lblError.Text = "No ha seleccionado ningún restaurante"
        End Try
    End Sub
End Class